<extend name="Common/index" />
<block name="content">
<link rel="stylesheet" href="__PUBLIC__/lib/layui/css/layui.css" media="all">
	<div style="position:fixed;top:0;width: 100%; border-top-style: solid;border-top-width: 2px;border-top-color: #009688;"></div>
	<article class="page-container">
		<form action="__URL__/editRoleHandle" method="post" class="form form-horizontal" id="form-admin-role-edit">
			<input type="hidden" name="id" value="{$role.id}"/>
			<br/><br/>
			<div class="col-xs-12 col-sm-12">
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-offset-1">
						<span class="c-red">*</span>角色名称：
					</label>
					<div class="formControls col-xs-5">
						<input type="text" class="input-text" value="{$role.name}" placeholder="" id="name" name="name">
					</div>
				</div>
				<br/>
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-offset-1">
						<span class="c-red">*</span>角色描述：
					</label>
					<div class="formControls col-xs-5">
						<input type="text" class="input-text" value="{$role.remark}" placeholder="" id="remark" name="remark">
					</div>
				</div>
				<br/>
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-offset-1">
						<span class="c-red">*</span>是否开启：
					</label>
					<div class="formControls col-xs-5">
						<input type="radio" class="" value="1" placeholder="" id="status" name="status" checked="checke">开启
						<input type="radio" class="" value="0" placeholder="" id="status" name="status">关闭
					</div>
				</div>
		  	<div class="layui-form-item" style="width:100%;height:45px;margin:0 auto;background:#fff;position:fixed;bottom:0;text-align:center;border-top-style: solid;border-top-width: 1px;border-top-color: #009688;padding-top: 5px;margin-left: -15px;" id="submit">
				<div class="layui-input-block" style="margin-left: -15px;">
					<button class="layui-btn layui-btn-radius" lay-submit="" lay-filter="demo1">
						<i class="Hui-iconfont"></i> 立即更新
					</button>
					<button type="reset" class="layui-btn layui-btn-radius layui-btn-primary">
						<i class="Hui-iconfont"></i> 重置
					</button>
					<button type="button" class="layui-btn layui-btn-radius layui-btn-primary" onclick="parent.location.reload()">
						<i class="Hui-iconfont"></i> 关闭
					</button>
				</div>
			</div>
		</form>
	</article>
</block>
<block name="js">
	<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript">
		$(function(){
			$(".permission-list dt input:checkbox").click(function(){
				$(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
			});
			$(".permission-list2 dd input:checkbox").click(function(){
				var l =$(this).parent().parent().find("input:checked").length;
				var l2=$(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
				if($(this).prop("checked")){
					$(this).closest("dl").find("dt input:checkbox").prop("checked",true);
					$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",true);
				}
				else{
					if(l==0){
						$(this).closest("dl").find("dt input:checkbox").prop("checked",false);
					}
					if(l2==0){
						$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",false);
					}
				}
			});
			$("#form-admin-role-edit").validate({
				rules:{
					roleName:{
						required:true,
					},
				},
				onkeyup:false,
				focusCleanup:true,
				success:"valid",
				submitHandler:function(form){
					$(form).ajaxSubmit();
					var index = parent.layer.getFrameIndex(window.name);
					parent.location.reload();
					parent.layer.msg('更新成功');
					parent.layer.close(index);
				}
			});
		});
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</block>